﻿using System;
using System;
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Text;
using netDxf;
using netDxf.Blocks;
using netDxf.Collections;
using netDxf.Entities;
using netDxf.Header;
using netDxf.Objects;
using netDxf.Tables;
using netDxf.Units;
using Attribute = netDxf.Entities.Attribute;
using Image = netDxf.Entities.Image;
using Point = netDxf.Entities.Point;
using Trace = netDxf.Entities.Trace;
using System.Threading;

namespace TestDxfDocument
{

    class Colietsfortoolholderswithtaperratio1_102
    {
        public static void _Colietsfortoolholderswithtaperratio1_102(Dictionary<string, Object> data)//B型弹簧夹头
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = fun.SetLayer("contour");//轮廓层
            Layer dimensioning = fun.SetLayer("dimensioning");//尺寸层
            Layer refin = fun.SetLayer("refin");//基准线/内轮廓/虚线
            Layer center = fun.SetLayer("center");//中心线
            Layer textlayer = fun.SetLayer("textlayer");//文本层
            Layer hatching = fun.SetLayer("hatching");//填充层
            Layer additionalline = fun.SetLayer("additionalline");//附加线
            Layer cutting = fun.SetLayer("cutting");//切削层



            //参数
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);

            double scale = Convert.ToDouble(data["scale"]); //放大系数
            //double scale = 5;


            double d1 = Convert.ToDouble(data["d1"]) * scale;
            double d2 = Convert.ToDouble(data["d2"]) * scale;
            double d3 = Convert.ToDouble(data["d3"]) * scale;
            double l1 = Convert.ToDouble(data["l1"]) * scale;
            double l3 = Convert.ToDouble(data["l3"]) * scale;
            double l4 = Convert.ToDouble(data["l4"]) * scale;
            double l5 = Convert.ToDouble(data["l5"]) * scale;


            //坐标
            Vector2 v1 = new Vector2(0, 0);
            Vector2 v2 = new Vector2(v1.X - d3 / 2 - 2, v1.Y);
            Vector2 v3 = new Vector2(v1.X + d3 / 2 + 2, v1.Y);
            Vector2 v4 = new Vector2(v1.X, v1.Y + d3 / 2 + 2);
            Vector2 v5 = new Vector2(v1.X, v1.Y - d3 / 2 - 2);
            Vector2 v6 = fun.Polar(v1, 110 * pi / 180, d1 / 2);
            Vector2 v7 = fun.Polar(v6, 120 * pi / 180, (d3 - d1) / 2);
            Vector2 v8 = new Vector2(v1.X - d3 / 19.783 / 2, v1.Y + d3 / 2);
            Vector2 v9 = new Vector2(v8.X, v8.Y - d3 / 5.083);
            Vector2 v10 = new Vector2(v9.X * -1, v9.Y);
            Vector2 v11 = new Vector2(v8.X * -1, v8.Y);
            Vector2 v12 = new Vector2(v7.X * -1, v7.Y);
            Vector2 v13 = new Vector2(v6.X * -1, v6.Y);
            Vector2 v14 = fun.Polar(v7, -60 * pi / 180, l4 * Math.Tan(30 * pi / 180));
            Vector2 v15 = new Vector2(v8.X, v8.Y - l4 * Math.Tan(30 * pi / 180));
            Vector2 v16 = new Vector2(v15.X, v15.Y * -1);
            Vector2 v17 = new Vector2(v14.X, v14.Y * -1);

            Vector2 v18 = new Vector2(v3.X + l1 + d3 / 2, v3.Y);
            Vector2 v19 = new Vector2(v18.X - l1 - 4, v18.Y);
            Vector2 v20 = new Vector2(v18.X - 2, v18.Y);
            Vector2 v22 = new Vector2(v20.X - l4 + l5, v20.Y + d3 / 2);
            Vector2 v21 = new Vector2(v20.X, v22.Y - l4 * Math.Tan(30 * pi / 180));
            Vector2 v23 = new Vector2(v22.X - l5 / 2, v22.Y);
            Vector2 v24 = new Vector2(v23.X, v23.Y - d3 / 17.969 / 2);
            Vector2 v25 = new Vector2(v24.X - l5 / 2, v24.Y);
            Vector2 v26 = new Vector2(v25.X, v25.Y - d3 / 17.969 / 2);
            Vector2 v27 = new Vector2(v26.X - l3 / 2.42, v26.Y);
            Vector2 v29 = new Vector2(v25.X - l3, v20.Y + d2 / 2);
            Vector2 v28 = new Vector2(v27.X, v29.Y + (v27.X - v29.X) * Math.Tan(2.866 * pi / 180));
            Vector2 v30 = new Vector2(v20.X - l1, v29.Y - (l1 - l3 - l4) * Math.Tan(2.866 * pi / 180));
            Vector2 v31 = new Vector2(v21.X, v21.Y * -1);
            Vector2 v32 = new Vector2(v22.X, v22.Y * -1);
            Vector2 v33 = new Vector2(v23.X, v23.Y * -1);
            Vector2 v34 = new Vector2(v24.X, v24.Y * -1);
            Vector2 v35 = new Vector2(v25.X, v25.Y * -1);
            Vector2 v36 = new Vector2(v26.X, v26.Y * -1);
            Vector2 v37 = new Vector2(v27.X, v27.Y * -1);
            Vector2 v38 = new Vector2(v28.X, v28.Y * -1);
            Vector2 v39 = new Vector2(v29.X, v29.Y * -1);
            Vector2 v40 = new Vector2(v30.X, v30.Y * -1);
            Vector2 v41 = new Vector2(v20.X, v20.Y + (v11.X - v8.X) / 2);
            Vector2 v42 = new Vector2(v30.X, v41.Y);
            Vector2 v43 = new Vector2(v41.X, v41.Y * -1);
            Vector2 v44 = new Vector2(v42.X, v43.Y);
            Vector2 v45 = new Vector2(v21.X, v21.Y - d3 / 13.043);
            Vector2 v46 = new Vector2(v22.X, v22.Y - d3 / 13.043);
            Vector2 v47 = new Vector2(v23.X, v46.Y);
            Vector2 v48 = new Vector2(v26.X, v46.Y);
            Vector2 v49 = new Vector2(v27.X, v48.Y - (v48.X - v27.X) * Math.Tan(2.866 * pi / 180));
            Vector2 v50 = new Vector2(v30.X, v30.Y - (v28.Y - v49.Y));
            Vector2 v51 = new Vector2(v45.X, v45.Y - d3 / 56.833);
            Vector2 v52 = new Vector2(v46.X, v46.Y - (v45.Y - v51.Y));
            Vector2 v53 = new Vector2(v47.X, v47.Y - (v45.Y - v51.Y));
            Vector2 v54 = new Vector2(v48.X, v48.Y - (v45.Y - v51.Y));
            Vector2 v55 = new Vector2(v49.X, v49.Y - (v45.Y - v51.Y));
            Vector2 v56 = new Vector2(v50.X, v50.Y - (v45.Y - v51.Y));
            Vector2 v57 = new Vector2(v45.X, v45.Y * -1);
            Vector2 v58 = new Vector2(v46.X, v46.Y * -1);
            Vector2 v59 = new Vector2(v47.X, v47.Y * -1);
            Vector2 v60 = new Vector2(v48.X, v48.Y * -1);
            Vector2 v61 = new Vector2(v49.X, v49.Y * -1);
            Vector2 v62 = new Vector2(v50.X, v50.Y * -1);
            Vector2 v63 = new Vector2(v51.X, v51.Y * -1);
            Vector2 v64 = new Vector2(v52.X, v52.Y * -1);
            Vector2 v65 = new Vector2(v53.X, v53.Y * -1);
            Vector2 v66 = new Vector2(v54.X, v54.Y * -1);
            Vector2 v67 = new Vector2(v55.X, v55.Y * -1);
            Vector2 v68 = new Vector2(v56.X, v56.Y * -1);
            Vector2 v69 = new Vector2(v45.X, v45.Y - d3 / 6.167);
            Vector2 v70 = new Vector2(v46.X, v46.Y - (v45.Y - v69.Y));
            Vector2 v71 = new Vector2(v47.X, v70.Y);
            Vector2 v72 = new Vector2(v48.X, v48.Y - (v45.Y - v69.Y));
            Vector2 v73 = new Vector2(v49.X, v49.Y - (v45.Y - v69.Y));
            Vector2 v74 = new Vector2(v50.X, v50.Y - (v45.Y - v69.Y));
            Vector2 v75 = new Vector2(v51.X, v51.Y - (v45.Y - v69.Y));
            Vector2 v76 = new Vector2(v52.X, v52.Y - (v45.Y - v69.Y));
            Vector2 v77 = new Vector2(v53.X, v53.Y - (v45.Y - v69.Y));
            Vector2 v78 = new Vector2(v54.X, v54.Y - (v45.Y - v69.Y));
            Vector2 v79 = new Vector2(v72.X, v72.Y + (v45.Y - v51.Y));
            Vector2 v80 = new Vector2(v73.X, v73.Y + (v45.Y - v51.Y));
            Vector2 v81 = new Vector2(v74.X, v74.Y + (v45.Y - v51.Y));
            Vector2 v82 = new Vector2(v69.X, v69.Y * -1);
            Vector2 v83 = new Vector2(v70.X, v70.Y * -1);
            Vector2 v84 = new Vector2(v71.X, v71.Y * -1);
            Vector2 v85 = new Vector2(v72.X, v72.Y * -1);
            Vector2 v86 = new Vector2(v73.X, v73.Y * -1);
            Vector2 v87 = new Vector2(v74.X, v74.Y * -1);
            Vector2 v88 = new Vector2(v75.X, v75.Y * -1);
            Vector2 v89 = new Vector2(v76.X, v76.Y * -1);
            Vector2 v90 = new Vector2(v77.X, v77.Y * -1);
            Vector2 v91 = new Vector2(v78.X, v78.Y * -1);
            Vector2 v92 = new Vector2(v79.X, v79.Y * -1);
            Vector2 v93 = new Vector2(v80.X, v80.Y * -1);
            Vector2 v94 = new Vector2(v81.X, v81.Y * -1);
            Vector2 v95 = new Vector2(v50.X + l1 / 4.986, v50.Y + l1 / 4.986 * Math.Tan(2.866 * pi / 180));
            Vector2 v96 = new Vector2(v95.X, v95.Y - (v50.Y - v56.Y));
            Vector2 v97 = new Vector2(v80.X - l1 / 31.295, v80.Y - l1 / 31.295 * Math.Tan(2.866 * pi / 180));
            Vector2 v98 = new Vector2(v97.X, v97.Y - (v80.Y - v73.Y));
            Vector2 v99 = new Vector2(v95.X, v42.Y);
            Vector2 v100 = new Vector2(v99.X, v44.Y);
            Vector2 v101 = new Vector2(v98.X, v98.Y * -1);
            Vector2 v102 = new Vector2(v97.X, v97.Y * -1);
            Vector2 v103 = new Vector2(v96.X, v96.Y * -1);
            Vector2 v104 = new Vector2(v95.X, v95.Y * -1);
            Vector2 v105 = new Vector2(v73.X, v41.Y);
            Vector2 v106 = new Vector2(v105.X, v43.Y);

            Vector2 va1 = new Vector2(v20.X, d1 / 2);
            Vector2 va2 = fun.Polar2(va1, l1, 180);


            //作图
            Line line1 = new Line(v3, v2);
            line1.Layer = center;
            line1.Linetype = Linetype.DashDot;
            line1.LinetypeScale = 3;
            dxf.AddEntity(line1);

            Line line2 = new Line(v4, v5);
            line2.Layer = center;
            line2.Linetype = Linetype.DashDot;
            line2.LinetypeScale = 3;
            dxf.AddEntity(line2);

            LwPolyline line3 = new LwPolyline();
            line3.Vertexes.Add(new LwPolylineVertex(v6));
            line3.Vertexes.Add(new LwPolylineVertex(v7));
            line3.Vertexes.Add(new LwPolylineVertex(v8));
            line3.Vertexes.Add(new LwPolylineVertex(v9));
            line3.Vertexes.Add(new LwPolylineVertex(v10));
            line3.Vertexes.Add(new LwPolylineVertex(v11));
            line3.Vertexes.Add(new LwPolylineVertex(v12));
            line3.Vertexes.Add(new LwPolylineVertex(v13));
            line3.Vertexes[1].Bulge = Math.Tan(-24 * pi / 180 / 4);
            line3.Vertexes[5].Bulge = Math.Tan(-24 * pi / 180 / 4);
            fun.PolyFill(dxf, line3, 0.5, contour);

            LwPolyline line4 = new LwPolyline();
            line4.Vertexes.Add(new LwPolylineVertex(v14));
            line4.Vertexes.Add(new LwPolylineVertex(v15));
            line4.Vertexes[0].Bulge = Math.Tan(-24 * pi / 180 / 4);
            fun.PolyFill(dxf, line4, 0.5, contour);

            LwPolyline line5 = new LwPolyline();
            line5.Vertexes.Add(new LwPolylineVertex(v16));
            line5.Vertexes.Add(new LwPolylineVertex(v17));
            line5.Vertexes[0].Bulge = Math.Tan(-24 * pi / 180 / 4);
            fun.PolyFill(dxf, line5, 0.5, contour);

            fun.drawcircle(dxf, v1, d1 / 2, 0.5, contour);

            LwPolyline[] linepoarray1 = new LwPolyline[100];
            linepoarray1 = fun.arrayrpolyline(line3, 6);
            for (int i = 1; i <= 6; i++)
            {
                fun.PolyFill(dxf, linepoarray1[i], 0.5, contour);
            }
            ;

            LwPolyline[] linepoarray2 = new LwPolyline[100];
            linepoarray2 = fun.arrayrpolyline(line4, 6);
            for (int i = 1; i <= 6; i++)
            {
                fun.PolyFill(dxf, linepoarray2[i], 0.5, contour);
            }
            ;

            LwPolyline[] linepoarray3 = new LwPolyline[100];
            linepoarray3 = fun.arrayrpolyline(line5, 6);
            for (int i = 1; i <= 6; i++)
            {
                fun.PolyFill(dxf, linepoarray3[i], 0.5, contour);
            }
            ;

            LwPolyline line6 = new LwPolyline();
            line6.Vertexes.Add(new LwPolylineVertex(v52));
            line6.Vertexes.Add(new LwPolylineVertex(v22));
            line6.Vertexes.Add(new LwPolylineVertex(v21));
            line6.Vertexes.Add(new LwPolylineVertex(v31));
            line6.Vertexes.Add(new LwPolylineVertex(v32));
            line6.Vertexes.Add(new LwPolylineVertex(v64));
            fun.PolyFill(dxf, line6, 0.5, contour);

            LwPolyline line7 = new LwPolyline();
            line7.Vertexes.Add(new LwPolylineVertex(v22));
            line7.Vertexes.Add(new LwPolylineVertex(v23));
            line7.Vertexes.Add(new LwPolylineVertex(v47));
            fun.PolyFill(dxf, line7, 0.5, contour);

            LwPolyline line8 = new LwPolyline();
            line8.Vertexes.Add(new LwPolylineVertex(v24));
            line8.Vertexes.Add(new LwPolylineVertex(v25));
            line8.Vertexes.Add(new LwPolylineVertex(v48));
            fun.PolyFill(dxf, line8, 0.5, contour);

            LwPolyline line9 = new LwPolyline();
            line9.Vertexes.Add(new LwPolylineVertex(v26));
            line9.Vertexes.Add(new LwPolylineVertex(v27));
            fun.PolyFill(dxf, line9, 0.5, contour);

            LwPolyline line10 = new LwPolyline();
            line10.Vertexes.Add(new LwPolylineVertex(v49));
            line10.Vertexes.Add(new LwPolylineVertex(v28));
            line10.Vertexes.Add(new LwPolylineVertex(v29));
            line10.Vertexes.Add(new LwPolylineVertex(v30));
            line10.Vertexes.Add(new LwPolylineVertex(v40));
            line10.Vertexes.Add(new LwPolylineVertex(v38));
            line10.Vertexes.Add(new LwPolylineVertex(v61));
            fun.PolyFill(dxf, line10, 0.5, contour);

            LwPolyline line11 = new LwPolyline();
            line11.Vertexes.Add(new LwPolylineVertex(v32));
            line11.Vertexes.Add(new LwPolylineVertex(v33));
            line11.Vertexes.Add(new LwPolylineVertex(v59));
            fun.PolyFill(dxf, line11, 0.5, contour);

            LwPolyline line12 = new LwPolyline();
            line12.Vertexes.Add(new LwPolylineVertex(v34));
            line12.Vertexes.Add(new LwPolylineVertex(v35));
            line12.Vertexes.Add(new LwPolylineVertex(v60));
            fun.PolyFill(dxf, line12, 0.5, contour);

            LwPolyline line13 = new LwPolyline();
            line13.Vertexes.Add(new LwPolylineVertex(v36));
            line13.Vertexes.Add(new LwPolylineVertex(v37));
            fun.PolyFill(dxf, line13, 0.5, contour);

            LwPolyline line14 = new LwPolyline();
            line14.Vertexes.Add(new LwPolylineVertex(v45));
            line14.Vertexes.Add(new LwPolylineVertex(v46));
            line14.Vertexes.Add(new LwPolylineVertex(v48));
            line14.Vertexes.Add(new LwPolylineVertex(v49));
            line14.Vertexes.Add(new LwPolylineVertex(v50));
            fun.PolyFill(dxf, line14, 0.5, contour);

            LwPolyline line15 = new LwPolyline();
            line15.Vertexes.Add(new LwPolylineVertex(v51));
            line15.Vertexes.Add(new LwPolylineVertex(v52));
            line15.Vertexes.Add(new LwPolylineVertex(v54));
            line15.Vertexes.Add(new LwPolylineVertex(v55));
            line15.Vertexes.Add(new LwPolylineVertex(v56));
            fun.PolyFill(dxf, line15, 0.5, contour);

            LwPolyline line16 = new LwPolyline();
            line16.Vertexes.Add(new LwPolylineVertex(v57));
            line16.Vertexes.Add(new LwPolylineVertex(v58));
            line16.Vertexes.Add(new LwPolylineVertex(v60));
            line16.Vertexes.Add(new LwPolylineVertex(v61));
            line16.Vertexes.Add(new LwPolylineVertex(v62));
            fun.PolyFill(dxf, line16, 0.5, contour);

            LwPolyline line17 = new LwPolyline();
            line17.Vertexes.Add(new LwPolylineVertex(v63));
            line17.Vertexes.Add(new LwPolylineVertex(v64));
            line17.Vertexes.Add(new LwPolylineVertex(v66));
            line17.Vertexes.Add(new LwPolylineVertex(v67));
            line17.Vertexes.Add(new LwPolylineVertex(v68));
            fun.PolyFill(dxf, line17, 0.5, contour);

            Line line18 = new Line(v18, v19);
            line18.Layer = center;
            line18.Linetype = Linetype.DashDot;
            line18.LinetypeScale = 3;
            dxf.AddEntity(line18);

            LwPolyline line19 = new LwPolyline();
            line19.Vertexes.Add(new LwPolylineVertex(v69));
            line19.Vertexes.Add(new LwPolylineVertex(v70));
            line19.Vertexes.Add(new LwPolylineVertex(v72));
            line19.Vertexes.Add(new LwPolylineVertex(v54));
            fun.PolyFill(dxf, line19, 0.5, contour);

            LwPolyline line20 = new LwPolyline();
            line20.Vertexes.Add(new LwPolylineVertex(v53));
            line20.Vertexes.Add(new LwPolylineVertex(v71));
            line20.Vertexes.Add(new LwPolylineVertex(v70));
            line20.Vertexes.Add(new LwPolylineVertex(v52));
            fun.PolyFill(dxf, line20, 0.5, contour);

            LwPolyline line21 = new LwPolyline();
            line21.Vertexes.Add(new LwPolylineVertex(v75));
            line21.Vertexes.Add(new LwPolylineVertex(v76));
            line21.Vertexes.Add(new LwPolylineVertex(v78));
            line21.Vertexes.Add(new LwPolylineVertex(v72));
            line21.Vertexes.Add(new LwPolylineVertex(v73));
            line21.Vertexes.Add(new LwPolylineVertex(v74));
            line21.Vertexes.Add(new LwPolylineVertex(v81));
            line21.Vertexes.Add(new LwPolylineVertex(v80));
            line21.Vertexes.Add(new LwPolylineVertex(v79));
            fun.PolyFill(dxf, line21, 0.5, contour);

            LwPolyline line22 = new LwPolyline();
            line22.Vertexes.Add(new LwPolylineVertex(v82));
            line22.Vertexes.Add(new LwPolylineVertex(v83));
            line22.Vertexes.Add(new LwPolylineVertex(v85));
            line22.Vertexes.Add(new LwPolylineVertex(v66));
            fun.PolyFill(dxf, line22, 0.5, contour);

            LwPolyline line23 = new LwPolyline();
            line23.Vertexes.Add(new LwPolylineVertex(v65));
            line23.Vertexes.Add(new LwPolylineVertex(v84));
            line23.Vertexes.Add(new LwPolylineVertex(v83));
            line23.Vertexes.Add(new LwPolylineVertex(v64));
            fun.PolyFill(dxf, line23, 0.5, contour);

            LwPolyline line24 = new LwPolyline();
            line24.Vertexes.Add(new LwPolylineVertex(v88));
            line24.Vertexes.Add(new LwPolylineVertex(v89));
            line24.Vertexes.Add(new LwPolylineVertex(v91));
            line24.Vertexes.Add(new LwPolylineVertex(v92));
            line24.Vertexes.Add(new LwPolylineVertex(v93));
            line24.Vertexes.Add(new LwPolylineVertex(v94));
            line24.Vertexes.Add(new LwPolylineVertex(v87));
            line24.Vertexes.Add(new LwPolylineVertex(v86));
            line24.Vertexes.Add(new LwPolylineVertex(v85));
            fun.PolyFill(dxf, line24, 0.5, contour);

            LwPolyline line25 = new LwPolyline();
            line25.Vertexes.Add(new LwPolylineVertex(v55));
            line25.Vertexes.Add(new LwPolylineVertex(v80));
            fun.PolyFill(dxf, line25, 0.5, contour);

            LwPolyline line26 = new LwPolyline();
            line26.Vertexes.Add(new LwPolylineVertex(v73));
            line26.Vertexes.Add(new LwPolylineVertex(v105));
            fun.PolyFill(dxf, line26, 0.5, contour);

            LwPolyline line27 = new LwPolyline();
            line27.Vertexes.Add(new LwPolylineVertex(v93));
            line27.Vertexes.Add(new LwPolylineVertex(v67));
            fun.PolyFill(dxf, line27, 0.5, contour);

            LwPolyline line28 = new LwPolyline();
            line28.Vertexes.Add(new LwPolylineVertex(v78));
            line28.Vertexes.Add(new LwPolylineVertex(v91));
            line28.Vertexes.Add(new LwPolylineVertex(v90));
            line28.Vertexes.Add(new LwPolylineVertex(v77));
            line28.Vertexes.Add(new LwPolylineVertex(v76));
            line28.Vertexes.Add(new LwPolylineVertex(v89));
            fun.PolyFill(dxf, line28, 0.5, contour);

            LwPolyline line29 = new LwPolyline();
            line29.Vertexes.Add(new LwPolylineVertex(v41));
            line29.Vertexes.Add(new LwPolylineVertex(v42));
            line29.Vertexes.Add(new LwPolylineVertex(v44));
            line29.Vertexes.Add(new LwPolylineVertex(v43));
            fun.PolyFill(dxf, line29, 0.5, contour);

            LwPolyline line30 = new LwPolyline();
            line30.Vertexes.Add(new LwPolylineVertex(v95));
            line30.Vertexes.Add(new LwPolylineVertex(v96));
            fun.PolyFill(dxf, line30, 0.5, contour);

            LwPolyline line31 = new LwPolyline();
            line31.Vertexes.Add(new LwPolylineVertex(v97));
            line31.Vertexes.Add(new LwPolylineVertex(v98));
            fun.PolyFill(dxf, line31, 0.5, contour);

            LwPolyline line32 = new LwPolyline();
            line32.Vertexes.Add(new LwPolylineVertex(v99));
            line32.Vertexes.Add(new LwPolylineVertex(v100));
            fun.PolyFill(dxf, line32, 0.5, contour);

            LwPolyline line33 = new LwPolyline();
            line33.Vertexes.Add(new LwPolylineVertex(v101));
            line33.Vertexes.Add(new LwPolylineVertex(v102));
            fun.PolyFill(dxf, line33, 0.5, contour);

            LwPolyline line34 = new LwPolyline();
            line34.Vertexes.Add(new LwPolylineVertex(v103));
            line34.Vertexes.Add(new LwPolylineVertex(v104));
            fun.PolyFill(dxf, line34, 0.5, contour);

            LwPolyline line35 = new LwPolyline();
            line35.Vertexes.Add(new LwPolylineVertex(v106));
            line35.Vertexes.Add(new LwPolylineVertex(v86));
            fun.PolyFill(dxf, line35, 0.5, contour);


            Line line36 = new Line(va1, va2);
            Line line37 = fun.mirrorline(line36, v19, v20);


            fun.AddEntities(dxf, refin, line36, line37);


            //标注

            double height = 3.5;
            double arrowsize = height;
            double exline = height / 2;
            double offset = 10;




            fun.dimrot1(dxf, v31, v40, 180, offset * 3 + (v31 + v40).Y / 2 - v32.Y, 1, height, arrowsize, exline, "l1=" + l1 / scale, "", "");
            fun.dimrot1(dxf, v35, v39, 180, offset * 2 + (v35 + v39).Y / 2 - v32.Y, 1, height, arrowsize, exline, "l3=" + l3 / scale, "", "");
            fun.dimrot1(dxf, v31, v35, 180, offset * 2 + (v31 + v35).Y / 2 - v32.Y, 1, height, arrowsize, exline, "l4=" + l4 / scale, "", "");
            fun.dimrot1(dxf, v32, v35, 180, offset + (v32 + v35).Y / 2 - v32.Y, 1, height, arrowsize, exline, "l5=" + l5 / scale, "", "");

            fun.dimrot1(dxf, va1, fun.Polar2(va1, d1, -90), -90, offset, 1, height, arrowsize, exline, "d1=%%C" + d1 / scale, "", "");
            fun.dimrot1(dxf, v29, v39, -90, 0, 1, height, arrowsize, exline, "d2=%%C" + d2 / scale, "", "");
            fun.dimrot1(dxf, v22, v32, -90, offset * 2 + (v20 - v22).X, 1, height, arrowsize, exline, "d3=%%c" + d3 / scale, "", "");


            fun.jtbz(dxf, (v39 + v40) / 2, 180 + 45, offset, offset, "1:10", height, height);


            double isframe = Convert.ToInt32(data["isframe"]);
            String isframe_chose = Convert.ToString(data["isframe_chose"]);
            Vector2 p0 = new Vector2(0, 0);
            if (isframe == 1)
            {
                if (isframe_chose.Equals("0"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA0X(dxf, new Vector2(p0.X - 1189 / 2.0, p0.Y + 841 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("1"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA1X(dxf, new Vector2(p0.X - 841 / 2.0, p0.Y + 594 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("2"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA2X(dxf, new Vector2(p0.X - 594 / 2.0, p0.Y + 420 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("3"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(p0.X - 420 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4X"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4X(dxf, new Vector2(p0.X - 297 / 2.0, p0.Y + 210 / 2.0 - 10 * 2.26), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4Y"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4Y(dxf, new Vector2(p0.X - 210 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }


            fun.SetLayer(dxf); fun.SetByLayer(dxf);


            //定义格式，路径导出
            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);


        }

    }
}

